package archive

import (
	"compress/lzw"
	"io"
)

var Lzw = &compressLzw{}

type compressLzw struct {
	order    lzw.Order
	litWidth int
}

func (receiver *compressLzw) Reader(reader io.Reader) io.Reader {
	lzwReader := lzw.NewReader(reader, 0, 0)
	defer lzwReader.Close()

	return lzwReader
}
func (receiver *compressLzw) Writer(writer io.Writer) io.Writer {
	lzwWriter := lzw.NewWriter(writer, 0, 0)
	defer lzwWriter.Close()

	return lzwWriter
}

func (receiver *compressLzw) SetOrder(order lzw.Order) *compressLzw {
	receiver.order = order

	return receiver
}
func (receiver *compressLzw) SetLitWidth(litWidth int) *compressLzw {
	receiver.litWidth = litWidth

	return receiver
}
